package com.bobi.ecofavor.service.impl;

import com.bobi.ecofavor.common.utils.JsonResponse;
import com.bobi.ecofavor.model.domain.FuelCard;
import com.bobi.ecofavor.mapper.FuelCardMapper;
import com.bobi.ecofavor.service.FuelCardService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 加油卡 服务实现类
 * </p>
 *
 * @author wenyuan
 * @since 2023-10-21
 */
@Service
public class FuelCardServiceImpl extends ServiceImpl<FuelCardMapper, FuelCard> implements FuelCardService {
    @Autowired
    private FuelCardMapper fuelCardMapper;

    @Override
    public List<FuelCard> selectUserCard(Integer userId) {
        List<FuelCard> fuelCards=fuelCardMapper.selectByUserId(userId);
        return  fuelCards;
    }

    @Override
    public Integer updateCardState(FuelCard fuelCard) {
        Integer updateNum=fuelCardMapper.updateByUserId(fuelCard);
        return  updateNum;
    }

    @Override
    public Integer updateCardAmount(FuelCard fuelCard) {
        Integer updateAmount=fuelCardMapper.updateAmount(fuelCard);
        return updateAmount;
    }

}
